﻿Imports DataAccess
Imports Entities
Public Class FormaPagoBL
    Public Shared Function List() As List(Of FORMAPAGOS)
        Dim lista As New List(Of FORMAPAGOS)
        lista = FormaPagoDAL.List
        Debug.Print("FormaPagoBL.List.Count= " + lista.Count.ToString)
        If lista.Count > 0 Then
            Return lista
        Else
            Return Nothing
        End If

    End Function
    Public Shared Function Save(ByVal zobject As FORMAPAGOS) As FORMAPAGOS
        If FormaPagoDAL.Exist(zobject.FORMAPAGO) Then
            Return FormaPagoDAL.Update(zobject)
        Else
            Return FormaPagoDAL.Create(zobject)
        End If
    End Function

    Public Shared Function Delete(ByVal zId As Long) As Boolean
        Return FormaPagoDAL.Delete(zId)
    End Function

    Public Shared Function SearchById(ByVal zId As Long) As FORMAPAGOS
        Return FormaPagoDAL.SearchById(zId)
    End Function
    Public Shared Function GetDescripcion(ByVal zId As Long) As String
        Dim formPago = SearchById(zId)
        If IsNothing(formPago) Then
            Return ""
        Else
            Return formPago.DESCRIPCION
        End If
    End Function
End Class
